package hotel.demo2.controller;

import hotel.demo2.common.domain.Hotel;
import hotel.demo2.common.domain.HotelExample;
import hotel.demo2.mapper.HotelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class HelloController {
    @Autowired
    HotelMapper hotelMapper;
    @RequestMapping("/")
    public String hotelInfo(Model model){
        List<Hotel> hotels = hotelMapper.selectAll();
        model.addAttribute("hotels",hotels);
        return "index";
    }

}
